<% provide(:title, "文章列表") %>

<!--文章列表模块-->
<div class="container">
  <div class="row">
    <div class="col-8">
      <ul>
        <% cache  @articles do %>
          <% @articles.each do |article| %>
            <% cache article do %>

              <div class="card">
                <h3 class="card-header"><%= article.title %></h3>
                <h3>
                  <%= truncate strip_tags(article.content), length: 80 %>
                </h3>
                <div id="text-right">
                  <%= button_to '查看', article,
                                :method => :get, class: "btn btn-primary pull-right" %>
                </div>
                <div>
                  <% if article.category.present? %>
                    分类：<span class="badge badge-primary">
                        <%= article.category.name %>
                     </span>
                  <% end %>
                </div>
                <p>最后修改时间: <%= edit_time(article) %></p>
                <p>作者： <%= article.user.name %></p>
              </div>
            <% end %>
          <% end %>
        <% end %>
      </ul>
    </div>

  </div>
</div>

<div class="article_paginate">
  <%= paginate @articles %>
</div>
